package example.runner;

import service.network.NetworkManageService;
import materials.network.AbstractNetworkCreation;
import materials.network.NetworkInterface;
import materials.network.NeuronalNetwork;
import materials.neurons.Neurons;

/**
 * Nur zum Netze erstellen gedacht.
 * @author Ramox
 */
public class RunnerNetz extends AbstractNetworkCreation
{
	
	
	public RunnerNetz(){
		createNet();
	}
	/**
	 * Erstellt das Neuronale Netz
	 */
	private void createNet()
	{
		NetworkInterface n = new NeuronalNetwork();

		NetworkManageService nms = new NetworkManageService(n);

		nms.raiseLayer();
		nms.raiseLayer();
		nms.raiseLayer();


		for (int i = 1; i < 34; i++)
		{
			nms.addNeuronToNetwork(1, "a"+i, Neurons.Linear);
		}
		for(int i = 34; i < 56;i++){
			nms.addNeuronToNetwork(2, "a"+i, Neurons.Sigmoid);
		}
		for(int i = 56; i < 64;i++){
			nms.addNeuronToNetwork(3, "a"+i, Neurons.Sigmoid);
		}
		
		
		for (int i = 1; i < 34; i++)
		{
			for (int j = 34; j < 56; j++)
			{	
				
				nms.connectTwoNeurons(1,"a"+i, "a"+j);
				nms.setWeightOfTwoNeurons(1 ,"a"+i, "a"+j, (Math.random()-0.5)*2);
				
			}
		}
		
		for (int i = 26; i < 56; i++)
		{
			for (int j = 56; j < 64; j++)
			{	
				
				nms.connectTwoNeurons(2,"a"+i, "a"+j);
				nms.setWeightOfTwoNeurons(2 ,"a"+i, "a"+j, (Math.random()-0.5)*2);
				
			}
		}
	
		addNet(n);
	}
}
